import type { RouteRecordRaw, RouteMeta } from "vue-router";

//在定义 Vue 组件时提供类型推导的辅助函数。
import { defineComponent } from "vue";

export type Component<T = any> =
  //ReturnType：获取函数返回值的类型
  //typeof: 获取变量的类型
  | ReturnType<typeof defineComponent>
  | (() => Promise<typeof import("*.vue")>)
  | (() => Promise<T>);

//extends: 实现类型的继承
//Omit:从类型中过滤掉指定属性
export interface AppRouteRecordRaw
  extends Omit<RouteRecordRaw, "meta" | "children"> {
  name: string;
  meta: RouteMeta;
  component?: Component | string;
  components?: Component;
  children?: AppRouteRecordRaw[];
  props?: Recordable;
  fullPath?: string;
}

export type AppRouteModule = AppRouteRecordRaw;
